﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using FoundationClass.Entity;

namespace P2MARY_INTERNET.Controls
{
    public partial class ComputerDialog : Form
    {
        public ComputerDialog()
        {
            InitializeComponent();
        }
        public Computer Computer;

        private void btnOK_Click(object sender, EventArgs e)
        {
            char status;
            char type;
            if (txtComId.Text.Trim().Length == 0 || txtComDetail.Text.Trim().Length == 0)
            {
                lblValidate.Text = @"กรูณากรอกข้อมูลให้ครบ";
                txtComId.Focus();
                return;
            }
            if (drpstatus.SelectedIndex == 0)
            {
                status = 'A';
            }
            else
            {
                status = 'I';
            }

            if (drptype.SelectedIndex == 0)
            {
                type = 'I';
            }
            else
            {
                type = 'G';
            }
            Computer = new Computer
            {
                ComputerName = txtComId.Text,
                Specification = txtComDetail.Text,
                Status = status,
                ComputerType = type
            };
            DialogResult = DialogResult.OK;
        }


    }
}
